package com.hmkj.core.mapper.investAccountLog;

import com.hmkj.common.baseMapper.GenericMapper;
import com.hmkj.core.model.investAccountLog.InvestAccountLogModel;
import com.hmkj.core.po.investAccountLog.InvestAccountLog;
import com.hmkj.core.po.order.Order;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 投资人股票账户记录相关Dao接口<br>
 *
 * @author lizhijie
 * @date   2018-07-07 06:41:47
 */
public interface InvestAccountLogMapper extends GenericMapper< InvestAccountLog,Integer> {

    /**
     * 账户记录列表
     *
     * @param params
     * @return
     */
    @Select("SELECT t.* FROM s_invest_account_log t LEFT JOIN biz_user u ON u.id = t.user_id WHERE 1 = 1 ${whereSql} ${sortSql} limit ${nowPage}, ${pageSize}")
    List<InvestAccountLogModel> findListBySqlJoin(Map<String, Object> params);

    /**
     * 统计
     * @param params
     * @return
     */
    @Select("SELECT count(1) FROM s_invest_account_log t LEFT JOIN biz_user u ON u.id = t.user_id WHERE 1 = 1 ${whereSql}")
    long countBySqlJoin(Map<String, Object> params);

    @Select("SELECT * FROM s_invest_account_log WHERE del_flag = 1 AND DATE_FORMAT(deal_number,'%m-%d-%Y') = DATE_FORMAT(NOW(),'%m-%d-%Y') ")
    List<InvestAccountLog> selectTodayDealOrder();
}
